<template>
  <div class="w-full mt-2 rounded-2xl card-list-box flex justify-center items-center">
    <div class="card-list-item  rounded-2xl shadow-xl flex justify-around items-center text-white font-sans font-bold">
      <div v-for="(title,k) in tableTitle"
           :key="k"
           class="h-full card-box-item flex flex-col items-center justify-center hover:text-black hover:rounded-xl"
           style="width: 90px;">
        <div class="text-sm font-bold text-center break-words w-full px-1">{{ title.label }}</div>
        <div class="text-base font-semibold text-center break-words w-full px-1">{{ item[title.key] }}</div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { defineProps } from 'vue'

const props = defineProps({
  item: {
    type: Object,
    required: true
  },
  tableTitle:{
    type: Array,
    required: true
  }
})
</script>

<style scoped lang="scss">
.card-list-box {
  //height: 50px;
  //position: relative;
  //background: linear-gradient(120deg, rgba(119, 191, 230, 0.47), rgba(197, 232, 252, 0.69));
  //// border: 1px solid rgba(110, 193, 241, 0.5);
  //transition: all 0.3s ease;
  //animation: buttonPulse 2s infinite ease-in-out;

  .card-list-item {
    width: 98%;
    height: 65px;
    background: linear-gradient(100deg, #34acef, #7dc6f1);
    box-shadow: 0 4px 15px -1px rgba(12, 137, 223, 0.15);
    // border: 1px solid rgba(12, 137, 223, 0.3);
    position: relative;
    overflow: hidden;
    animation: buttonPulse 2s infinite ease-in-out;
    padding: 5px 10px;

    // 添加流光效果
    &::after {
      content: '';
      position: absolute;
      top: 0;
      left: -100%;
      width: 100%;
      height: 100%;
      background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%
      );
      animation: buttonShine 3s infinite;
    }
  }
}

.card-box-item {
  position: relative;
  transition: all 0.2s ease;
  min-width: 90px;
  max-width: 90px;
  word-break: break-word;

  &:hover {
    background-color: rgba(197, 232, 252, 0.69);
    transform: scale(1.1);

    &::after {
      content: '';
      position: absolute;
      bottom: -2px;
      left: 50%;
      transform: translateX(-50%);
      width: 80%;
      height: 2px;
      background: rgba(255, 255, 255, 0.8);
      border-radius: 2px;
    }
  }

  .text-xs {
    opacity: 0.9;
  }

  .text-base {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  }
}

@keyframes buttonPulse {
  0%, 100% {
    box-shadow: 0 0 0 rgba(52, 172, 239, 0.4);
  }
  50% {
    box-shadow: 0 0 5px rgba(52, 172, 239, 0.6);
  }
}

// @keyframes buttonShine {
//   0% {
//     left: -50%;
//   }
//   50%, 100% {
//     left: 50%;
//   }
// }
</style>
